#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests
import base64
import re

HEADERS = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36',
            #'Referer' : 'https://kyfw.12306.cn/otn/leftTicket/init',
            #'Host' : 'kyfw.12306.cn'
          }

username = 'test'
password = '123456'

base64string = base64.encodestring('{0}:{1}'.format(username, password))[:-1]
HEADERS['Authorization'] = 'Basic %s' %base64string

result =  requests.post('http://120.131.7.232:8000/queue_info.html', headers=HEADERS)

print result.status_code
print result.text

robot_list = re.findall(u'process\(([^\(\)]*)\)\S*机器人数量:([0-9]*)', result.text)
print robot_list
